﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GnufExtension.h"
#include "GnufDropdownMenuDefinition.h"
#include "GnufButtonDefinition.h"
#include "OwnerPtr.h"

    /// \file GnufExtensionDefinitionManager.h
    /// \brief 管理外部的按钮定义
namespace gnuf {
    class GnufButtonDefinition;
    class GnufDropdownMenuDefinition;

    /// \brief 外部按钮定义的管理器，可以使用代码来增加按钮定义，GNUF负责管理
    class GNUF_EXTENSION_EXPORT ExtensionDefinitionManager
    {
        CANNOT_COPY_OR_ASSIGN(ExtensionDefinitionManager)
    public:
        static ExtensionDefinitionManager* get();

        /// \brief 添加一个buttondefition的定义
        /// \param cmdId 绑定的CommandId
        /// \param bInteractive 是否时交互时的命令
        /// \param caption  按钮的caption
        /// \param toolTip  按钮的toolTip
        /// \param iconDir  按钮的icon文件夹
        /// \return 成功返回true
        bool addButtonDefinition(const std::wstring& cmdId,
            bool bInteractive,
            const std::wstring& caption,
            const std::wstring& toolTip,
            const std::wstring& iconDir);

        /// \brief 添加一个buttondefition的定义
       /// \param cmdId 绑定的CommandId
       /// \param bInteractive 是否时交互时的命令
       /// \param caption  按钮的caption
       /// \param toolTip  按钮的toolTip
       /// \param iconDir  按钮的icon文件夹
        /// \param caption2  按钮的caption2
       /// \param toolTip2  按钮的toolTip2
       /// \param iconDir2  按钮的icon2文件夹
       /// \param wantToHandleToggling  按钮状态切换
       /// \return 成功返回true
        bool addButtonDefinition2(const std::wstring& cmdId,
            bool bInteractive,
            const std::wstring& caption,
            const std::wstring& toolTip,
            const std::wstring& iconDir,
            const std::wstring& caption2,
            const std::wstring& toolTip2,
            const std::wstring& iconDir2,
            bool wantToHandleToggling);

        /// \brief 添加一个DropdownMenuDefition的定义
        /// \param cmdId    绑定的id
        /// \param caption  按钮的caption
        /// \param toolTips  按钮的toolTip
        /// \param iconDir  按钮的icon文件夹
        /// \return 成功返回true
        bool addDropdownMenuDefinition(const std::wstring& cmdId,
            const std::wstring& caption,
            const std::wstring& toolTips,
            const std::wstring& iconDir);

    private:
        ExtensionDefinitionManager();
        std::vector<gcmp::OwnerPtr<gnuf::GnufButtonDefinition>> m_buttonDefs;
        std::vector<gcmp::OwnerPtr<gnuf::GnufDropdownMenuDefinition>> m_dropdownMenuDefs;
    };
}
